<!--  -->
<template>
  <div class="main">
    <el-card v-if="typee==='card'" class="ik-chart-card">
      <div slot="header" class="clearfix">
        <span class="ik-chart-card-title">{{ title }}</span>
        <p class="table_title_img" />
        <span class="logo" />
      </div>

      <div v-if="type==='circle'" class="board">
        <div v-for="item in data" :key="item.keyfield" class="circle_board" :style="'width:' + size + ';' ">
          <el-progress
            v-if="type=='circle'"
            type="circle"
            :percentage="item.num ?item.num : 100 "
            :show-text="false"
          />
          <div class="circle_board_content">
            <p>{{ item.valuefield }}</p>
            <p>{{ item.keyfield }}</p>
          </div>
        </div>
      </div>
      <div v-else class="board">
        <div v-for="item in data" :key="item.keyfield" class="square_board">
          <div class="square_board_content">
            <p>{{ item.valuefield }}</p>
            <p>{{ item.keyfield }}</p>
          </div>
        </div>
      </div>
    </el-card>
    <div v-else :style="{height:'100%', width:'100%'}">
      <div v-if="type==='circle'" class="board">
        <div v-for="item in data" :key="item.keyfield" class="circle_board" :style="'width:' + size + ';' ">
          <el-progress
            v-if="type=='circle'"
            type="circle"
            :percentage="item.num ?item.num : 100 "
            :show-text="false"
          />
          <div class="circle_board_content">
            <p>{{ item.valuefield }}</p>
            <p>{{ item.keyfield }}</p>
          </div>
        </div>
      </div>
      <div v-else class="board">
        <div v-for="item in data" :key="item.keyfield" class="square_board">
          <div class="square_board_content">
            <p>{{ item.valuefield }}</p>
            <p>{{ item.keyfield }}</p>
          </div>
        </div>
      </div>
    </div>

  </div>
</template>

<script>

export default {
  components: {

  },
  props: {
    type: {
      type: String,
      default: 'circle'
    },
    val: {
      type: Array,
      default: function() {
        return []
      }
    },
    typee: {
      type: String,
      default: 'card'
    },
    size: {
      type: String,
      default: '100px'
    }
  },
  data() {
    return {
      title: '方形圆形卡片'
      // data: [
      //   { keyfield: '抢救进度', valuefield: '85%', num: 85 }

      // ]
    }
  },
  computed: {
    data() {
      return this.val
    }
  },
  watch: {
    // val(val, oldval) {
    //   console.log(val, '===================卡片=================')
    //   this.data = val
    // }
  },
  created() {

  },
  mounted() {

  },

  methods: {

  }
}
</script>
<style lang='scss' scoped>
.main{
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
  position: relative;

.board{
  width: auto;
  display: flex;
  flex-flow: row ; // 以行排列 并且允许换行
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: space-around;
  // position: absolute;
  // top: 200px;
  // background-image: url('../assets/robot/bg.png');
  // image-rendering: auto;
  // background-repeat: no-repeat;
  // background-size: 100% 100%;
  // border-radius: 0px;
  // background-color:transparent ;
  ::v-deep.circle_board{

    position: relative;
    margin: 10px 10px;
    .el-progress{
      // width: 110px;
      // height: 110px;
      width: 100%;
      height: 100%!important;
      .el-progress-circle{
        width: 100%!important;
        height: 100%!important;
      }
    }

    .circle_board_content{
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      margin: auto;
      height: 50%;
      p{
        width: 100%;
        text-align: center;
        height: 50%;
        // color: #606266;
        // color: white;
        font-size: 13px;
        margin: 0;
      }
    }
  }
  .square_board{
    width: 100px;
    height: 100px;
    position: relative;
    // margin: 4% 5%;
    margin: 10px 10px;
    background-color: #409EFF;
    // background-image: linear-gradient(to top, #30cfd0 0%, #330867 100%);
    .square_board_content{
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      margin: auto;
      height: 60px;
      p{
        width: 100%;
        text-align: center;
        height: 30px;
        // color: #606266;
        color: white;
        font-size: 16px;
        margin: 0;
      }
    }
  }
}
}
</style>
